#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
    int arr[10][10] = { 0 };
    int arr1[10][10] = { 0 };
    int line = 0;
    int t = 0;
    int row = 0;
    while (scanf("%d %d", &line, &row) == 2)
    {
        for (int i = 0; i < line; i++)
            for (int j = 0; j < row; j++)
                scanf("%d", &arr[i][j]);

        for (int i = 0; i < line; i++)
        {
            for (int j = 0; j < row; j++)
            {
                arr1[j][i] = arr[i][j];
            }
        }
        for (int i = 0; i < row; i++)
        {
            for (int j = 0; j < line; j++)
                printf("%d ", arr1[i][j]);
            printf("\n");
        }
    }
    return 0;
}